import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
import NotFound from '@/components/404'
import Home from '@/components/Home'
import GatewayTable from '@/components/logging/gatewayTable'
import ChartShow from '@/components/chart/chartShow'
import CommandManage from '@/components/command/commandManage'
import CommandAdd from '@/components/command/CommandAdd'
import MonitorRole from '@/components/monitor/monitorRole'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      children: [
        { path: '/gatewaytable', component: GatewayTable, name: '网关列表',
        meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }},
      ]
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      leaf: true,
      children: [
        { path: '/chartshow', component: ChartShow, name: '图表展示', 
        meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        } },
      ]
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      leaf: true,
      children: [
        { path: '/commandmanage', component: CommandManage, name: '命令管理',meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        } },
        { path: '/commandadd', component: CommandAdd, name: '命令添加',meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        } }
      ]
    },
    {
      path:'/',
      name:'Home',
      component:Home,
      children:[
        { path:'/monitorrole', component: MonitorRole, name:'模拟发送',meta: {
          requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
        }},
      ]
    },
    {
      path: '*',
      name: 'NotFound',
      component: NotFound,
    },
  ]
})
